#ifndef __LOGIN_H_
#define __LOGIN_H_
#include "StdSqlite.h"

struct USER
{
    char Name[30];
    char account[30];
    char passwd[30];
};
typedef struct USER User;

int start(User *user1);
int Register(User *user1, SQL *s);
int Login(User *user1, SQL *s);
void DeleteAccount(SQL *s);
void DisplayRegisterUser();

void CreateFriendTable(char *FromName);
int MatchFriend(char *FromName, char *Toname);
void InsertFriendData(char *FromName, char *ToName);
void DisplayFriends(char *FromName);
DLlist *GetFriendsData(char *FromName);
void DisplayOnlineFriends(char *FromName);
void deleteFriends(char *fromName, char *toName);

void CreateChatRecordTable(char *FromName);
void ChatRecordSaved(char *FromName, char *content, char *ToName);
void DisplayCharRecord(char *fromName);

int IsUserExit(char *name);
void InsertOnlineUser(char *FromName);
void DisplayOnlineUser();
void DeleteOnlineUser(char *FromName);
int IsOnline(char *name);
void CreateOfflineTable(char *FromName);
void insertOfflineChat(char *FromName, char *content, char *ToName);
void DisplayOfflineChat(char *name);
void deleteOfflineChat(char *name);

void MakeGroupFolder(char *name);
void CreateGroupTable(char *name);
void CreateGroup(char *fromName, char *name1);
void PullGroup(char *fromName, char *ToName, char *groupName);
void PullGroup2(char *fromName, char *groupName);
int CheckGroupExit(char *tableName);
int MatchGroup(char *Name, char *groupName);
int Matchuser(char *name, char *groupName);
DLlist *GetGroupMembers(char *groupName);
DLlist *FindGroupIntersection(DLlist *list1, DLlist *list2);
void insertGroupChat(char *fromName, char *content, char *groupName);

void MakeFileFolder(char *name);
int IfFolderExit(char *name, char *FromName);
int IfFolderExit2(char *name, char *FromName);
#endif